package com.tensquare.base.controller;

import entity.Result;
import entity.StatusCode;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * @BelongsProject: tensquare_parent
 * @BelongsPackage: com.tensquare.base.controller
 * @Author: yang
 * @CreateTime: 2019-03-04 17:25
 * @Description: ${Description}
 */

/**
公共异常处理类
 */
@RestControllerAdvice
public class BaseExceptionHandler {
    @ExceptionHandler(value=Exception.class)
    public Result exception(Exception e){
        return new Result(false, StatusCode.ERROR,e.getMessage());
    }
}
